<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<button>获取users</button>


<script>
    let btns = document.querySelectorAll('button');

    btns[0].onclick = async function() {
        // let res = await fetch('/users', {
        //     method: 'get'
        // });
        // console.log(res.headers.get('content-type'));


        let headers = new Headers();
        headers.append('content-type', 'application/json') ;

        let req = new Request('/users', {
            method: 'get',
            headers
        });

        let rs = await fetch(req);

        console.log(rs.headers.get('content-type'));

        let data = await rs.json();
        console.log(data);
    }
</script>
</body>
</html>
